package Chapter2.Comparing.c8;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class FileInputDemo3 {
    public static void main(String[] args) {
        try {
            FileReader fr = new FileReader("Doc/a.txt");
            FileWriter fw = new FileWriter("Doc/b.txt");
            int a;
            while((a=fr.read())!=-1) {
                fw.write(a);
                System.out.println((char) a);
            }
            fw.close();fr.close();
        }
        catch (FileNotFoundException e){
            System.out.println(e.getMessage());
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }
}
